package lab02.test25;

import java.util.Scanner;

/**
 * Created by 林云志 on 2017/10/30.
 */
public class Test {
    public static void main(String[] args) {
        //25、 	数字转换的异常处理。输入两个数，计算两个数想除的结果（考虑除数为0的异常情况）。
        Scanner scanner = new Scanner(System.in);
        boolean judge =true;
        System.out.println("这是两个数相除的程序");

        do  {
        System.out.println("请输入被除数");
        float number1 = scanner.nextFloat();
        System.out.println("请输入除数");
        float number2 = scanner.nextFloat();


        if (number2 == 0){
            System.out.println("错误！！被除数不能为0");
            judge = false;
        }
        float result;
        if (judge ==true){
        result = number1/number2;
            System.out.println("结果为："+result);}
        }while (judge ==false);
    }
}
